<template>
  <div>
    <button @click="isShow = !isShow">显示/影藏</button>
    <!-- 使用transtion包裹动画体，在关键时刻调用默认为 eg: v-enter-active  v-leave-active 
        如果给transtion加了name='hello'属性，那么关键帧动画为 hello-enter-active hello-leave-active
    -->
    <transition :appear="false">
         <h1 v-show="isShow">你好啊！</h1>
    </transition>
  </div>
</template>

<script>
export default {
    data() {
        return {
            isShow: true,
        }
    }
}
</script>

<style scoped>
    h1 {
        background-color: orange;
    }
    .v-enter-active {
        animation: atguigu 1s;
    }
    .v-leave-active {
        animation: atguigu 1s reverse;
    }
    @keyframes atguigu {
        from {
            transform: translateX(-100%);
        }
        to {
            transform: translateX(0px);
        }
    }
</style>